<%-- 
    Document   : index
    Created on : Dec 3, 2013, 9:42:29 PM
    Author     : Welcome
--%>

<%@page import="bc.entity.Capbac"%>
<%@page import="businesscard.DAO.CapbacDAO"%>
<%@page import="java.util.List"%>
<%@page import="bc.entity.Congty"%>
<%@page import="businesscard.DAO.CongtyDAO"%>
<%@page import="bc.entity.Hoadon"%>
<%@page import="businesscard.DAO.UserDAO"%>
<%@page import="bc.entity.User"%>
<%@page import="bc.entity.Binhluan"%>
<%@page import="businesscard.DAO.BinhluanDAO"%>
<%@page import="bc.entity.Lienhe"%>
<%@page import="businesscard.DAO.LienheDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link rel="stylesheet" href="css/bocuc.css" type="text/css"/>
        <link rel="stylesheet" href="css/style.css" type="text/css"/>
        <link rel="stylesheet" href="css/trangcanhan.css" type="text/css"/>
        <link rel="stylesheet" href="css/testcss.css" type="text/css"/>
        <link rel="stylesheet" href="css/mystyle.css" type="text/css"/>
        <link rel="stylesheet" href="css/botoncss.css" type="text/css"/>
        <script type="text/javascript" src="jquery/jquery-1.1.3.1.min.js"></script> 
        <script type="text/javascript" src="jquery/jquery-1.4.2.js"></script> 
        <script type="text/javascript" src="jquery/jquery-latest.js"></script>
        <script type="text/javascript" src="jquery/myjquery.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

        <title>Businesscard</title>
         <script type="text/javascript" src="jquery/jquery-1.8.0.min.js"></script>

      
          <script type="text/javascript" >
              
            $(function() {
                $(".inputsearch").keyup(function()
                {
                    var searchid = $(this).val();
                    var dataString = 'search=' + searchid;
                    if (searchid !== '')
                    {
                        $.ajax({
                            type: "POST",
                            url: "searchAjax.jsp",
                            data: dataString,
                            cache: false,
                            success: function(html)
                            {
                                $("#showhint").html(html).show();
                            }
                        });
                    }else{
                         jQuery("#showhint").hide();
                    }
                    return false;
                });

                jQuery("#showhint").live("click", function(e) {
                    var $clicked = $(e.target);
                    var $name = $clicked.find('.name').html();
                    var decoded = $("<div/>").html($name).text();
                    $('#searchid').val(decoded);
                });
                jQuery(document).live("click", function(e) {
                    var $clicked = $(e.target);
                    if (!$clicked.hasClass("inputsearch")) {
                        jQuery("#showhint").fadeOut();
                    }
                });
                $('#searchid').click(function() {
                    jQuery("#showhint").fadeIn();
                });
                
            });
        </script>
        <style type="text/css">
         //body{ 
         //       font-family:Tahoma, Geneva, sans-serif;
         //       font-size:18px;
         //   }
        //    .content{
        //        width:900px;
        //        margin:0 auto;
        //    }
            .name{
                width:446px;
                
                margin-top:-1px !important;
                background-color:transparent !important;
                margin-left:0;}
            #showhint
            {
                position:absolute;
                width:446px;
                padding:10px;
                display:none;
                margin-top:-1px;
                border-top:0px;
                overflow:hidden;
                border:1px #CCC solid;
                background-color: white;
                margin-left: 423px;
            }
            .show
            {
                padding:10px; 
                border-bottom:1px #999 dashed;
                font-size:15px; 
                height:50px;
            }
            .show:hover
            {
                background:#4c66a4;
                color:#FFF;
                cursor:pointer;
            }
            .name:hover
            {
                background:#4c66a4;
                color:#FFF;
                cursor:pointer;
            }
        </style>
        <script>
            var xmlhttp;
            function AddCart(str)
            {
                xmlhttp = GetXmlHttpObject();

                if (xmlhttp === null)
                {
                    alert("Your browser does not support Ajax HTTP");
                    return;
                }
                var url = "addCart.jsp";
                url = url + "?id=" + str;

                xmlhttp.onreadystatechange = getOutput;
                xmlhttp.open("GET", url, true);
                xmlhttp.send(null);
            }

            function getOutput()
            {
                // if (xmlhttp.readyState==4)
                // {
                document.getElementById("soluong").innerHTML = xmlhttp.responseText;
                //  }
            }

            function GetXmlHttpObject()
            {
                if (window.XMLHttpRequest)
                {
                    return new XMLHttpRequest();
                }
                if (window.ActiveXObject)
                {
                    return new ActiveXObject("Microsoft.XMLHTTP");
                }
                return null;
            }
        </script>
    </head>
    <body>
        <div class="bodypage">
            <!phan dau cua trang>
            <div class="top">
                <%@include file='header.jsp'%>
            </div>
            <!phan search>
            <div class="khoangcachtrang">
                <div class="searchgroup">

                    <%@include file='search.jsp' %> 
                    <div class="chontimkiem">
                        <a href="timkiemnangcao.jsp">Tìm Kiếm Nâng Cao</a>
                    </div>

                </div>
            </div>

            <!phan giua trang >
            <div class="centerpage">

                <div class="leftsite">
                    <div class="menuweb">
                        <%@include file='menuleft.jsp' %>
                    </div>
                </div>
                <div class="content">
                    <div class="khoangtrang"></div>

                    <div class="rentertindex ">



                        <%
                            int idcapbac = Integer.parseInt(request.getParameter("macapbac"));
                            CapbacDAO capbacdao = new CapbacDAO();
                            Capbac cb = capbacdao.getCapbacById(idcapbac);
                            String tencapbac = cb.getCapbac();

                            LienheDAO lienhedao = new LienheDAO();
                            List<Lienhe> lhlist = lienhedao.getLienheByCapbac(cb);
                        %>
                        <div class="lienhebycongty">
                            <div class="tencapbac"> CẤP BẬC <%=tencapbac%></div>

                        </div>
                        <table class="tablecongty">
                            <thead>
                            <td>STT</td>
                            <td>TÊN LIÊN HỆ </td>
                            <td>CÔNG TY</td>
                            <td>BỘ PHẬN</td>
                            <td>NGÀNH</td>
                            <td>QUẬN/HUYỆN</td>
                            <td>THÀNH PHỐ</td>

                            </thead>
                            <%
                                int stt = 0;
                                for (int i = 0; i < lhlist.size(); i++) {
                                    String tenlienhe = lhlist.get(i).getTen();
                                    String nganh = lhlist.get(i).getNganh().getNganh();
                                    String capbac = lhlist.get(i).getCapbac().getCapbac();
                                    String bophan = lhlist.get(i).getBophan().getBophan();
                                    int idbophan = lhlist.get(i).getBophan().getIdBophan();
                                    int idlienhe = lhlist.get(i).getIdLienhe();
                                    stt++;
                                    int idnganh = lhlist.get(i).getNganh().getIdNganh();
                                    int idcongty = lhlist.get(i).getCongty().getIdCongty();
                                    String congty = lhlist.get(i).getCongty().getCongty();
                                    String quan = lhlist.get(i).getQuanhuyen().getQuanhuyen();
                                    int idquan = lhlist.get(i).getQuanhuyen().getIdQuanhuyen();
                                    String tp = lhlist.get(i).getQuanhuyen().getThanhpho().getThanhpho();
                                    int idtp = lhlist.get(i).getQuanhuyen().getThanhpho().getIdThanhpho();

                            %>
                            <tr class="thongtin">
                                <td><%=stt%></td>
                                <td><a href="CTLienhe.jsp?malienhe=<%=idlienhe%>"><%=tenlienhe%></a></td>
                                <td><a href="LHbyCongty.jsp?macongty=<%=idcongty%>"><%=congty%></a></td>
                                <td><a href="LHbyBophan.jsp?mabophan=<%=idbophan%>"><%=bophan%></td>
                                <td><a href="LHbyNganh.jsp?manganh=<%=idnganh%>"><%=nganh%></a></td>
                                <td><a href="LHbyQuan.jsp?maquan=<%=idquan%>"><%=quan%></a></td>
                                <td><a href="LHbyThanhpho.jsp?mathanhpho=<%=idtp%>"><%=tp%></a></td>
                            </tr>
                            <%                            }
                            %>
                        </table>
                    </div>
                        <div class="khoangtrang"></div>
                </div>

            </div>
            <!phan cuoi trang>
            <div class="footer">
                <div class="footerleft"></div>
                <div class="footerright"></div>
            </div>
        </div>
    </body>
</html>
